
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:massagist/manager/config.dart';

import '../generated/l10n.dart';

class MassAppbar extends StatefulWidget implements PreferredSizeWidget {
  // 默认值
  String title;
  IconData backIocn;
  MassAppbar({Key? key, this.title = "", this.backIocn = Icons.arrow_back_ios_sharp}) : super(key: key);

  @override
  MassAppbarState createState() => MassAppbarState();

  @override
  // TODO: implement preferredSize
  Size get preferredSize => Size(double.infinity, 50.sp);
}

class MassAppbarState extends State<MassAppbar> {
  @override
  Widget build(BuildContext context) {
    return AppBar(
      title: Text(widget.title, style: NaviTitleStyle),
      iconTheme: IconThemeData(color: Colors.white),
      centerTitle: true,
      backgroundColor: Colors.transparent,
      shadowColor: Colors.transparent,
      elevation: 0,
      leading: IconButton(
        icon: Icon(widget.backIocn),
        color: Colors.black,
        onPressed: () {
          Navigator.pop(context);
        },
      ),
    );
  }
}